import time
import datetime

def printFuncTime(fn):
    def metric(*args, **kw):
        start_time = time.time()
        fn(*args, **kw)
        end_time = time.time()

        print('耗时：{:.4f}s'.format(end_time - start_time))
    return metric

@printFuncTime
def now():
    time.sleep(1)
    print(datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S'))

now()